package com.gc.frontend.web.action.ajax;

import com.alibaba.fastjson.JSONObject;
import com.gc.common.entity.Alert;
import com.gc.frontend.service.AlertService;
import com.gc.common.util.ReturnJsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * Created by 瑱彬 on 2015/4/30.
 */
@Controller
@RequestMapping("/ajax/alert")
public class AlertController {
    @Autowired
    private AlertService alertService;

    @RequestMapping("getAlerts")
    @ResponseBody
    public JSONObject getAlerts(String carImei) {
        List<Alert> alerts = this.alertService.getAlertsByImei(carImei);
        return ReturnJsonUtil.successRows(alerts);
    }
}
